package com.sheng.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

/**
 * <p>
 * 用户管理
 * </p>
 *
 * @author 王胜
 * @since 2022-11-19 15:56
 */
@Data
@Accessors(chain = true)
@TableName("sys_user")
@ApiModel(value = "User对象", description = "用户管理")
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class User extends Model<User> implements Serializable{

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("用户名")
    @TableField("username")
    private String username;

    @ApiModelProperty("昵称")
    @TableField("account")
    private String account;

    @ApiModelProperty("角色类型  1：管理员  2：一般角色")
    @TableField("role")
    private String role;

    @ApiModelProperty("密码")
    @TableField("password")
    private String password;

    @ApiModelProperty("用户头像url")
    @TableField("image_url")
    private String imageUrl;

    @ApiModelProperty("创建人ID")
    @TableField("create_by_id")
    private Long createById;

    @ApiModelProperty("创建人")
    @TableField("create_by")
    private String createBy;

    @ApiModelProperty("创建时间")
    @TableField("create_time")
    private LocalDateTime createTime;

    @ApiModelProperty("更新人ID")
    @TableField("last_update_by_id")
    private Long lastUpdateById;

    @ApiModelProperty("更新人")
    @TableField("last_update_by")
    private String lastUpdateBy;

    @ApiModelProperty("更新时间")
    @TableField("last_update_time")
    private LocalDateTime lastUpdateTime;

    @ApiModelProperty("是否删除  1：已删除  0：正常")
    @TableField("del_flag")
    private Integer delFlag;

    public User(User user) {
    }


    @Override
    public Serializable pkVal() {
        return this.id;
    }

}
